build: Expose autocleanups unconditionally, start using them
authorColin Walters <walters@verbum.org>
Thu, 23 Mar 2017 20:49:58 +0000 (16:49 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 28 Mar 2017 20:19:15 +0000 (20:19 +0000)
I'd like to do this in rpm-ostree at least. Originally I was looking at porting
to `G_DECLARE_FINAL_TYPE` but eh, this is easier for now and won't bump our GLib
dependency which might matter for our embedded users.

For now I just did a few replacements in the `remote` command line. A full port
can come as we do other code cleanups.

This will actually break the flatpak build right now, but
that's easy to fix.  And we concluded in e.g.
https://bugs.freedesktop.org/show_bug.cgi?id=95065#c5
it's a bug for downstream projects to do that.

Closes: #756
Approved by: jlebon

src/libostree/ostree-autocleanups.h
src/ostree/ot-remote-builtin-add-cookie.c
src/ostree/ot-remote-builtin-add.c
src/ostree/ot-remote-builtin-delete-cookie.c
src/ostree/ot-remote-builtin-delete.c
src/ostree/ot-remote-builtin-gpg-import.c
src/ostree/ot-remote-builtin-list-cookies.c
src/ostree/ot-remote-builtin-list.c
src/ostree/ot-remote-builtin-refs.c
src/ostree/ot-remote-builtin-show-url.c
src/ostree/ot-remote-builtin-summary.c

index 7301ef1d702a8d373f33b4e99d186761826edd07..f030b50ef7295d240f2f687fb04e5b99cbd50fb6 100644 (file)
 
 G_BEGIN_DECLS
 
-#ifndef OSTREE_WITH_AUTOCLEANUPS
-#define OSTREE_WITH_AUTOCLEANUPS 0
-#endif
-
 /* ostree can use g_autoptr backports from libglnx when glib is too
  * old, but still avoid exposing them to users that also have an old
  * glib */
-#if defined(OSTREE_COMPILATION) || (OSTREE_WITH_AUTOCLEANUPS && GLIB_CHECK_VERSION(2, 44, 0))
+#if defined(OSTREE_COMPILATION) || GLIB_CHECK_VERSION(2, 44, 0)
 
 /*
  * The following types have no specific clear/free/unref functions, so
index e4156172667712c4fcddf955d8ba1d7ea9186298..d5ea3da584f07a47d54d6b8d00952d2d28037742 100644 (file)
@@ -37,7 +37,7 @@ gboolean
 ot_remote_builtin_add_cookie (int argc, char **argv, GCancellable *cancellable, GError **error)
 {
   g_autoptr(GOptionContext) context = NULL;
-  glnx_unref_object OstreeRepo *repo = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
   const char *remote_name;
   const char *domain;
   const char *path;
index 93c989f92590ea16d785ad9b725a4c4e96f285ac..3e3aeda9784e3cf3806740bdcab3975cdce21aa0 100644 (file)
@@ -45,7 +45,7 @@ gboolean
 ot_remote_builtin_add (int argc, char **argv, GCancellable *cancellable, GError **error)
 {
   g_autoptr(GOptionContext) context = NULL;
-  glnx_unref_object OstreeRepo *repo = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
   const char *remote_name;
   const char *remote_url;
   char **iter;
index 6d1b85ad8bbbcd33284cba0fa159581f600e3dfb..cb1177fc8b5387f1ace3156930628483f757c51f 100644 (file)
@@ -37,7 +37,7 @@ gboolean
 ot_remote_builtin_delete_cookie (int argc, char **argv, GCancellable *cancellable, GError **error)
 {
   g_autoptr(GOptionContext) context = NULL;
-  glnx_unref_object OstreeRepo *repo = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
   const char *remote_name;
   const char *domain;
   const char *path;
index 8a4dd5f3bf3b0c4487dd57463bcaba13d7008ba6..cac1b7ead9cf371bff1ee1c912e1f34d06deaae9 100644 (file)
@@ -36,7 +36,7 @@ gboolean
 ot_remote_builtin_delete (int argc, char **argv, GCancellable *cancellable, GError **error)
 {
   g_autoptr(GOptionContext) context = NULL;
-  glnx_unref_object OstreeRepo *repo = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
   const char *remote_name;
   gboolean ret = FALSE;
 
index d1db06d0b9fa90f53ccdc7c2f85c9cd1b342d6f0..4df0dfe7fe68e5d23c5c5a4d730dfe1e8c09ec53 100644 (file)
@@ -94,7 +94,7 @@ gboolean
 ot_remote_builtin_gpg_import (int argc, char **argv, GCancellable *cancellable, GError **error)
 {
   g_autoptr(GOptionContext) context = NULL;
-  glnx_unref_object OstreeRepo *repo = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
   g_autoptr(GInputStream) source_stream = NULL;
   const char *remote_name;
   const char * const *key_ids;
index 1c3924af1d8f919b55f8ad5dfae862d68cd4d137..83d75a5781c0085908e4ffce3a5e0a88e09101c3 100644 (file)
@@ -36,7 +36,7 @@ gboolean
 ot_remote_builtin_list_cookies (int argc, char **argv, GCancellable *cancellable, GError **error)
 {
   g_autoptr(GOptionContext) context = NULL;
-  glnx_unref_object OstreeRepo *repo = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
   const char *remote_name;
   g_autofree char *jar_path = NULL;
   g_autofree char *cookie_file = NULL;
index faf8d8ad3e97a19a7914bf02c93bd34be28c9574..0769ece7f7b25c50bd627347069ed3484473f74b 100644 (file)
@@ -34,7 +34,7 @@ gboolean
 ot_remote_builtin_list (int argc, char **argv, GCancellable *cancellable, GError **error)
 {
   g_autoptr(GOptionContext) context = NULL;
-  glnx_unref_object OstreeRepo *repo = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
   g_auto(GStrv) remotes = NULL;
   guint ii, n_remotes = 0;
   gboolean ret = FALSE;
index 9e74291263e380bb1f85e86efee6422f530d288a..f5b3afe3b9c8015cf1ce6e04f5d264c133e422e4 100644 (file)
@@ -36,7 +36,7 @@ gboolean
 ot_remote_builtin_refs (int argc, char **argv, GCancellable *cancellable, GError **error)
 {
   g_autoptr(GOptionContext) context = NULL;
-  glnx_unref_object OstreeRepo *repo = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
   const char *remote_name;
   gboolean ret = FALSE;
   g_autoptr(GHashTable) refs = NULL;
index 401dfb0b166cdd5a048ff6763d01ae575febf4c9..c1666558ef1c488e86c82f9179aeff94fe356f77 100644 (file)
@@ -33,7 +33,7 @@ gboolean
 ot_remote_builtin_show_url (int argc, char **argv, GCancellable *cancellable, GError **error)
 {
   g_autoptr(GOptionContext) context = NULL;
-  glnx_unref_object OstreeRepo *repo = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
   const char *remote_name;
   g_autofree char *remote_url = NULL;
   gboolean ret = FALSE;
index 39321b53ffd8862ffdbddb1492281e5bd8674cc4..b4d9925410fc668bec3a274b01d8dd49e2c91af7 100644 (file)
@@ -40,7 +40,7 @@ gboolean
 ot_remote_builtin_summary (int argc, char **argv, GCancellable *cancellable, GError **error)
 {
   g_autoptr(GOptionContext) context = NULL;
-  glnx_unref_object OstreeRepo *repo = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
   const char *remote_name;
   g_autoptr(GBytes) summary_bytes = NULL;
   g_autoptr(GBytes) signature_bytes = NULL;